package com.example.design.结构型设计模式.装饰器模式;

// 4. 实现不同的装饰器
public class MilkDecorator extends CoffeeDecorator {

    public MilkDecorator(Coffee coffee) {
        super(coffee);
    }

    @Override
    public String getDescription() {
        return decoratedCoffee.getDescription() + ", 加牛奶";
    }

    @Override
    public double cost() {
        return decoratedCoffee.cost() + 0.5; // 加牛奶的价格
    }
}
